package com.ruoyi.contract.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.*;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName ice_base
 */
@TableName(value ="ice_base")
@Data
public class IceBase implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 
     */
    private String name;

    /**
     * remote application id
     */
    private Integer app;

    /**
     * scenes(mutli scene split with ,)
     */
    private String scenes;

    /**
     * 1 online 0 offline
     */
    private Integer status;

    /**
     * 
     */
    private Long confId;

    /**
     * see TimeTypeEnum
     */
    private Integer timeType;

    /**
     * 
     */
    private Date start;

    /**
     * 
     */
    private Date end;

    /**
     * 
     */
    private Integer debug;

    /**
     * 
     */
    private Long priority;

    /**
     * 
     */
    private Date createAt;

    /**
     * 
     */
    private Date updateAt;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 深拷贝
     * @return 新的IceBase对象
     */
    public IceBase deepCopyIceBase() {
        IceBase iceBase = null;
        try {
            // 将该对象序列化成流，因为写在流里的是对象的一个拷贝，而原对象仍然存在于JVM里面。所以利用这个特性可以实现对象的深拷贝
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(this);
            // 将流序列化成对象
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            ObjectInputStream ois = new ObjectInputStream(bais);
            iceBase = (IceBase) ois.readObject();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return iceBase;
    }
    
    
}